package com.czwj.action;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.czwj.entities.BudgetExecute;
import com.czwj.entities.BudgetMain;
import com.czwj.entities.BudgetSubItem;
import com.czwj.entities.Camera;
import com.czwj.entities.CameraTime;
import com.czwj.entities.CapitalApply;
import com.czwj.entities.Equipment;
import com.czwj.entities.EquipmentMark;
import com.czwj.entities.FinishApply;
import com.czwj.entities.ForumPost;
import com.czwj.entities.Goods;
import com.czwj.entities.GoodsCurrent;
import com.czwj.entities.PlanDaily;
import com.czwj.entities.PlanMain;
import com.czwj.entities.ProjectItem;
import com.czwj.entities.ProjectItemChild;
import com.czwj.entities.Quantities;
import com.czwj.entities.UrgentApply;
import com.czwj.entities.UserInfo;
import com.czwj.service.BudgetExecuteService;
import com.czwj.service.BudgetMainService;
import com.czwj.service.BudgetSubItemService;
import com.czwj.service.CameraService;
import com.czwj.service.CameraTimeService;
import com.czwj.service.CapitalApplyService;
import com.czwj.service.EquipmentMarkService;
import com.czwj.service.EquipmentService;
import com.czwj.service.FinishApplyService;
import com.czwj.service.ForumPostService;
import com.czwj.service.GoodsCurrentService;
import com.czwj.service.GoodsService;
import com.czwj.service.PlanDailyService;
import com.czwj.service.PlanMainService;
import com.czwj.service.ProjectItemChildService;
import com.czwj.service.ProjectItemService;
import com.czwj.service.QuantitiesService;
import com.czwj.service.SummaryUserService;
import com.czwj.service.UrgentApplyService;
import com.czwj.service.UserInfoService;

@Controller
public class ViewAction{
	@Resource
	ProjectItemService projectItemService;
	
	@Resource
	ProjectItemChildService projectItemChildService;
	
	@Resource
	PlanMainService planMainService;
	
	@Resource
	PlanDailyService planDailyService;
	
	@Resource
	BudgetMainService budgetMainService;
	
	@Resource
	BudgetSubItemService budgetSubItemService;
	
	@Resource
	FinishApplyService finishApplyService;
	
	@Resource
	BudgetExecuteService budgetExecuteService;
	
	@Resource
	CapitalApplyService capitalApplyService;
	
	@Resource
	UrgentApplyService urgentApplyService;
	
	@Resource
	SummaryUserService summaryUserService;
	
	@Resource
	GoodsService goodsService;
	
	@Resource
	GoodsCurrentService goodsCurrentService;
	
	@Resource
	CameraService cameraService;
	@Resource
	CameraTimeService cameraTimeService;
	
	@Resource
	ForumPostService forumPostService;
	
	@Resource
	UserInfoService userInfoService;
	
	@Resource
	QuantitiesService quantitiesService;
	
	@Resource
	EquipmentService equipmentService;
	
	@Resource
	EquipmentMarkService equipmentMarkService;
	
	@RequestMapping("/")
	public String index(HttpServletRequest request){
		Subject currentUser = SecurityUtils.getSubject();
		// LiteDeviceResolver deviceResolver = new LiteDeviceResolver();
		// Device device = deviceResolver.resolveDevice(request);
		// if (device.isMobile()){
		// return "redirect:/app/index";
		// }else{
		if(currentUser.getSession().getAttribute("userInfo") == null){
			return "login";
		}else{
			return "main";
		}
		// }
	}
	
	@RequestMapping(value = "/login")
	public String login(HttpServletRequest request){
		return "login";
	}
	
	@RequestMapping(value = "/help.do")
	public String help(){
		return "help/index";
	}
	
	@RequestMapping(value = "/imouplayer.do")
	public ModelAndView ImouPlayer(@RequestParam(value = "cameraid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		Camera camera = cameraService.selectByPrimaryKey(id);
		List<CameraTime> list = cameraTimeService.search();
		mav.addObject("camera",camera);
		mav.addObject("cameraTime",list.get(0));
		mav.setViewName("camera/ImouPlayer");
		return mav;
	}
	
	@RequestMapping(value = "/salary.do")
	public String salary(){
		return "finance/salary";
	}
	
	@RequestMapping(value = "/salaryfinace.do")
	public String salaryfinace(){
		return "finance/salaryfinace";
	}
	
	@RequestMapping(value = "/salarydaily.do")
	public String salarydaily(){
		return "finance/salarydaily";
	}
	
	@RequestMapping(value = "/camera.do")
	public ModelAndView camera(){
		ModelAndView mav = new ModelAndView();
		List<CameraTime> list = cameraTimeService.search();
		mav.addObject("cameraTime",list.get(0));
		mav.setViewName("camera/camera");
		return mav;
	}

	@RequestMapping(value = "/cameratime.do")
	public String cameratime(){
		return "camera/cameratime";
	}
	
	@RequestMapping(value = "/camerapermission.do")
	public String camerapermission(){
		return "camera/camerapermission";
	}
	
	@RequestMapping(value = "/authority.do")
	public String authority(){
		return "settings/authority";
	}
	
	@RequestMapping(value = "/settingsPer.do")
	public String settingsPer(){
		return "/settings/settingsPer.html";
	}
	
	@RequestMapping(value = "/forum.do")
	public String forum(){
		return "/forum/forum.html";
	}
	
	@RequestMapping(value = "/forumadmin.do")
	public String forumadmin(){
		return "/forum/forumadmin.html";
	}
	
	@RequestMapping(value = "/toreply.do")
	public ModelAndView toreply(@RequestParam(value = "postid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ForumPost forumPost = forumPostService.selectByPrimaryKey(id);
		mav.addObject("forumPost",forumPost);
		mav.setViewName("forum/reply.html");
		return mav;
	}
	
	@RequestMapping(value = "/toreplyadmin.do")
	public ModelAndView toreplyadmin(@RequestParam(value = "postid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ForumPost forumPost = forumPostService.selectByPrimaryKey(id);
		mav.addObject("forumPost",forumPost);
		mav.setViewName("forum/replyadmin.html");
		return mav;
	}
	
	@RequestMapping(value = "/toperson.do")
	public ModelAndView toperson(@RequestParam(value = "userid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		UserInfo userInfo = userInfoService.selectByPrimaryKey(id);
		mav.addObject("userInfo",userInfo);
		mav.setViewName("forum/person.html");
		return mav;
	}
	
	@RequestMapping(value = "/register")
	public String registe(){
		return "register";
	}
	
	@RequestMapping(value = "/logout")
	public ModelAndView logout(){
		ModelAndView mav = new ModelAndView();
		Subject currentUser = SecurityUtils.getSubject();
		currentUser.logout();
		mav.setViewName("login");
		return mav;
	}
	
	@RequestMapping(value = "/app/login")
	public String applogin(){
		return "/app/login";
	}
	
	@RequestMapping(value = "/reviewed.do")
	public String reviewed(){
		return "myreview/reviewed";
	}
	
	@RequestMapping(value = "/unreviewed.do")
	public String unreviewed(){
		return "myreview/unreviewed";
	}
	
	@RequestMapping(value = "/project.do")
	public String project(){
		Subject currentUser = SecurityUtils.getSubject();
		int roleid = ((UserInfo)currentUser.getSession().getAttribute("userInfo")).getRoleid();
		switch(roleid){
			case 1:
				return "myproject/level0";
			case 2:
				return "myproject/level1";
			case 3:
				return "myproject/level2";
			case 4:
				return "myproject/level3";
			default:
				return "404";
		}
	}
	
	@RequestMapping(value = "/myplan.do")
	public String mainplan(){
		return "myplan/myplan";
	}
	
	@RequestMapping(value = "/dailyplan.do")
	public ModelAndView dailyplan(@RequestParam(value = "mainplanid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		PlanMain main = planMainService.selectByPrimaryKey(id);
		mav.addObject("planmain",main);
		mav.setViewName("myplan/dailyplan");
		return mav;
	}
	
	@RequestMapping(value = "/budgetsubitem.do")
	public String budgetmain(){
		return "mybudget/budgetsubitem";
	}
	
	@RequestMapping(value = "/tocamera.do")
	public ModelAndView tocamera(){
		ModelAndView mav = new ModelAndView();
		List<CameraTime> list = cameraTimeService.search();
		mav.addObject("cameraTime",list.get(0));
		mav.setViewName("worksite/camera");
		return mav;
	}
	
	@RequestMapping(value = "/budgetexecute.do")
	public String budgetexecute(){
		return "worksite/budgetexecute";
	}
	
	@RequestMapping(value = "/report.do")
	public String report(){
		return "worksite/report";
	}
	
	@RequestMapping(value = "/toequipment.do")
	public String toequipment(){
		return "/equipment/equipment.html";
	}
	
	@RequestMapping(value = "/toequipmentmark.do")
	public String toequipmentmark(){
		return "/equipment/equipmentmark.html";
	}
	
	@RequestMapping(value = "/equipmentpressure.do")
	public ModelAndView equipmentpressure(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("equipmentid", id);
		mav.setViewName("/equipment/equipmentpressure");
		return mav;
	}
	
	@RequestMapping(value = "/goods.do")
	public String goods(){
		return "/goods/goods.html";
	}
	
	@RequestMapping(value = "/goodscurrent.do")
	public ModelAndView goodscurrent(@RequestParam(value = "goodsid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		Goods main = goodsService.selectByPrimaryKey(id);
		mav.addObject("goods",main);
		mav.setViewName("goods/goodscurrent");
		return mav;
	}
	
	@RequestMapping(value = "/budgetitem.do")
	public String budgetitem(){
		return "settings/budgetitem";
	}
	
	@RequestMapping(value = "/user.do")
	public String user(){
		return "settings/user";
	}
	
	@RequestMapping(value = "/warningvalue.do")
	public String warningvalue(){
		return "settings/warningvalue";
	}
	
	@RequestMapping(value = "/reviewlevel.do")
	public String reviewlevel(){
		return "settings/reviewlevel";
	}
	
	@RequestMapping(value = "/register.do")
	public String register(){
		return "settings/register";
	}
	
	@RequestMapping(value = "/log.do")
	public String log(){
		return "settings/log";
	}
	
	@RequestMapping(value = "/inspectionitem.do")
	public String inspectionItem(){
		return "settings/inspectionitem";
	}
	
	@RequestMapping(value = "/urgent.do")
	public String urgentapply(){
		return "worksite/urgentapply";
	}
	
	@RequestMapping(value = "/capital.do")
	public String capitalapply(){
		return "worksite/capitalapply";
	}
	
	@RequestMapping(value = "/finish.do")
	public String finishapply(){
		return "finishapply/finishapply";
	}
	
	@RequestMapping(value = "/quantities.do")
	public String quantities(){
		return "finishapply/quantities";
	}
	
	@RequestMapping(value = "/warningmoney.do")
	public String warningmoney(){
		return "warning/warningmoney";
	}
	
	@RequestMapping(value = "/warningtime.do")
	public String warningtime(){
		return "warning/warningtime";
	}
	
	@RequestMapping(value = "/warningsafe.do")
	public String warningsafe(){
		return "warning/warningsafe";
	}
	
	@RequestMapping(value = "/warningequipment.do")
	public String warninwarningequipmentgtips(){
		return "warning/warningequipment";
	}
	
	@RequestMapping(value = "/safe.do")
	public String safe(){
		return "worksite/safetyinspection";
	}
	
	@RequestMapping(value = "/attendance.do")
	public String attendance(){
		return "worksite/attendance";
	}
	
	@RequestMapping(value = "/mymail.do")
	public String mymail(){
		return "email/mymail";
	}
	
	@RequestMapping(value = "/recievemail.do")
	public String recievemail(){
		return "email/recievemail";
	}
	
	@RequestMapping(value = "/sendmail.do")
	public String sendmail(){
		return "email/sendmail";
	}
	
	@RequestMapping(value = "/sendmailbox.do")
	public String sendmailbox(){
		return "email/sendmailbox";
	}
	
	@RequestMapping(value = "/bossmailbox.do")
	public String bossmailbox(){
		return "email/bossmailbox";
	}
	
	@RequestMapping(value = "/summarypermission.do")
	public String summarypermission(){
		return "summary/summarypermission";
	}
	
	/*
	 * @RequestMapping(value = "/summary.do") public String summary(){ Subject currentUser = SecurityUtils.getSubject(); UserInfo userInfo =
	 * (UserInfo)currentUser.getSession().getAttribute("userInfo"); List<SummaryUser> list = summaryUserService.selectAll(); for(int i = 0;i <
	 * list.size();i++){ if(list.get(i).getUserid() == userInfo.getId()){ return "summary/summary"; } } return "summary/nopermission"; }
	 */
	@RequestMapping(value = "/summary.do")
	public String summary(){
		return "summary/summary";
	}
	
	@RequestMapping(value = "/summary2.do")
	public String summary2(){
		return "summary/summary2";
	}
	
	@RequestMapping(value = "/yearsummary.do")
	public String yearsummary(){
		return "summary/yearsummary";
	}
	
	@RequestMapping(value = "/unreviewed/goods.do")
	public ModelAndView unreviewedgoods(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myreview/unreviewed/goods");
		return mav;
	}
	
	@RequestMapping(value = "/unreviewed/goodscurrent.do")
	public ModelAndView unreviewedgoodscurrent(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myreview/unreviewed/goodscurrent");
		return mav;
	}
	
	@RequestMapping(value = "/unreviewed/quantities.do")
	public ModelAndView unreviewedquantities(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myreview/unreviewed/quantities");
		return mav;
	}
	
	@RequestMapping(value = "/unreviewed/planmain.do")
	public ModelAndView unreviewedplanmain(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myreview/unreviewed/planmain");
		return mav;
	}
	
	@RequestMapping(value = "/unreviewed/plandaily.do")
	public ModelAndView unreviewedplandaily(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myreview/unreviewed/plandaily");
		return mav;
	}
	
	@RequestMapping(value = "/unreviewed/budgetmain.do")
	public ModelAndView unreviewedbudgetmain(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myreview/unreviewed/budgetmain");
		return mav;
	}
	
	@RequestMapping(value = "/unreviewed/budgetexecute.do")
	public ModelAndView unreviewedbudgetexecute(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myreview/unreviewed/budgetexecute");
		return mav;
	}
	
	@RequestMapping(value = "/unreviewed/urgentapply.do")
	public ModelAndView unreviewedurgentapply(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myreview/unreviewed/urgentapply");
		return mav;
	}
	
	@RequestMapping(value = "/unreviewed/capitalapply.do")
	public ModelAndView unreviewedcapitalapply(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myreview/unreviewed/capitalapply");
		return mav;
	}
	
	@RequestMapping(value = "/unreviewed/finishapply.do")
	public ModelAndView unreviewedfinishapply(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		FinishApply finish = finishApplyService.searchbyprojectitemid(id);
		mav.addObject("finish",finish);
		mav.setViewName("myreview/unreviewed/finishapply");
		return mav;
	}
	
	@RequestMapping(value = "/toplanmain.do")
	public ModelAndView toplanmain(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/toplanmain");
		return mav;
	}
	
	@RequestMapping(value = "/toplandaily.do")
	public ModelAndView toplandaily(@RequestParam(value = "mainplanid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		PlanMain main = planMainService.selectByPrimaryKey(id);
		mav.addObject("planmain",main);
		mav.setViewName("myproject/toplandaily");
		return mav;
	}
	
	@RequestMapping(value = "/tobudgetmain.do")
	public ModelAndView tobudgetmain(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tobudgetmain");
		return mav;
	}
	
	@RequestMapping(value = "/tobudgetsubitem.do")
	public ModelAndView tobudgetsubitem(@RequestParam(value = "budgetmainid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		BudgetMain budgetMain = budgetMainService.selectByPrimaryKey(id);
		mav.addObject("budgetMain",budgetMain);
		mav.setViewName("myproject/tobudgetsubitem");
		return mav;
	}
	
	@RequestMapping(value = "/toattendance.do")
	public ModelAndView toattendance(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ProjectItem item = projectItemService.selectByPrimaryKey(id);
		mav.addObject("projectitem",item);
		mav.setViewName("myproject/toattendance");
		return mav;
	}
	
	@RequestMapping(value = "/tosafetyinspection.do")
	public ModelAndView tosafetyinspection(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ProjectItem item = projectItemService.selectByPrimaryKey(id);
		mav.addObject("projectitem",item);
		mav.setViewName("myproject/tosafetyinspection");
		return mav;
	}
	
	@RequestMapping(value = "/toreport.do")
	public ModelAndView toreport(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ProjectItem item = projectItemService.selectByPrimaryKey(id);
		mav.addObject("projectitem",item);
		mav.setViewName("myproject/toreport");
		return mav;
	}
	
	@RequestMapping(value = "/tourgentapply.do")
	public ModelAndView tourgentapply(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tourgentapply");
		return mav;
	}
	
	@RequestMapping(value = "/tocapitalapply.do")
	public ModelAndView tocapitalapply(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tocapitalapply");
		return mav;
	}
	
	@RequestMapping(value = "/towarningtips.do")
	public ModelAndView towarningtips(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/towarningtips");
		return mav;
	}
	
	@RequestMapping(value = "/tofinishapply.do")
	public ModelAndView tofinishapply(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tofinishapply");
		return mav;
	}
	
	@RequestMapping(value = "/tomoneyinfo.do")
	public ModelAndView tomoneyinfo(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tomoneyinfo");
		return mav;
	}
	
	@RequestMapping(value = "/toschedule.do")
	public ModelAndView toschedule(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/toschedule");
		return mav;
	}
	
	@RequestMapping(value = "/toplanmainchild.do")
	public ModelAndView toplanmainchild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/toplanmainchild");
		return mav;
	}
	
	@RequestMapping(value = "/toplandailychild.do")
	public ModelAndView toplandailychild(@RequestParam(value = "mainplanid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		PlanMain main = planMainService.selectByPrimaryKey(id);
		mav.addObject("planmain",main);
		mav.setViewName("myproject/toplandailychild");
		return mav;
	}
	
	@RequestMapping(value = "/tobudgetmainchild.do")
	public ModelAndView tobudgetmainchild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tobudgetmainchild");
		return mav;
	}
	
	@RequestMapping(value = "/tobudgetsubitemchild.do")
	public ModelAndView tobudgetsubitemchild(@RequestParam(value = "budgetmainid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		BudgetMain budgetMain = budgetMainService.selectByPrimaryKey(id);
		mav.addObject("budgetMain",budgetMain);
		mav.setViewName("myproject/tobudgetsubitemchild");
		return mav;
	}
	
	@RequestMapping(value = "/toattendancechild.do")
	public ModelAndView toattendancechild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ProjectItemChild item = projectItemChildService.selectByPrimaryKey(id);
		mav.addObject("projectitem",item);
		mav.setViewName("myproject/toattendancechild");
		return mav;
	}
	
	@RequestMapping(value = "/tosafetyinspectionchild.do")
	public ModelAndView tosafetyinspectionchild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ProjectItemChild item = projectItemChildService.selectByPrimaryKey(id);
		mav.addObject("projectitem",item);
		mav.setViewName("myproject/tosafetyinspectionchild");
		return mav;
	}
	
	@RequestMapping(value = "/toreportchild.do")
	public ModelAndView toreportchild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ProjectItemChild item = projectItemChildService.selectByPrimaryKey(id);
		mav.addObject("projectitem",item);
		mav.setViewName("myproject/toreportchild");
		return mav;
	}
	
	@RequestMapping(value = "/tourgentapplychild.do")
	public ModelAndView tourgentapplychild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tourgentapplychild");
		return mav;
	}
	
	@RequestMapping(value = "/tocapitalapplychild.do")
	public ModelAndView tocapitalapplychild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tocapitalapplychild");
		return mav;
	}
	
	@RequestMapping(value = "/towarningtipschild.do")
	public ModelAndView towarningtipschild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/towarningtipschild");
		return mav;
	}
	
	@RequestMapping(value = "/tofinishapplychild.do")
	public ModelAndView tofinishapplychild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tofinishapplychild");
		return mav;
	}
	
	@RequestMapping(value = "/tomoneyinfochild.do")
	public ModelAndView tomoneyinfochild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/tomoneyinfochild");
		return mav;
	}
	
	@RequestMapping(value = "/toschedulechild.do")
	public ModelAndView toschedulechild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("myproject/toschedulechild");
		return mav;
	}
	
	@RequestMapping(value = "/proprietorpro.do")
	public String yezhupro(){
		return "proprietor/proprietorpro";
	}
	
	@RequestMapping(value = "/proprietorvideo.do")
	public String yezhuvideo(){
		return "proprietor/proprietorvideo";
	}
	
	// app
	@RequestMapping(value = "/app/index.do")
	public ModelAndView appindex(HttpServletRequest request){
		ModelAndView mav = new ModelAndView();
		mav.setViewName("app/menu1");
		return mav;
	}
	
	@RequestMapping(value = "/app/attendance.do")
	public String appattendance(HttpServletRequest request){
		return "app/functions/attendance";
	}
	
	@RequestMapping(value = "/app/safe.do")
	public String appsafe(HttpServletRequest request){
		return "app/functions/safetyinspection";
	}
	
	@RequestMapping(value = "/app/report.do")
	public String appreport(HttpServletRequest request){
		return "app/functions/report";
	}
	
	@RequestMapping(value = "/app/budgetexecute.do")
	public String appbudgetexecute(HttpServletRequest request){
		return "app/functions/budgetexecute";
	}
	
	@RequestMapping(value = "/app/urgentapply.do")
	public String appurgentapply(HttpServletRequest request){
		return "app/functions/urgentapply";
	}
	
	@RequestMapping(value = "/app/capitalapply.do")
	public String appcapitalapply(HttpServletRequest request){
		return "app/functions/capitalapply";
	}
	
	@RequestMapping(value = "/app/warning.do")
	public String appwarning(HttpServletRequest request){
		return "app/functions/warning";
	}
	
	@RequestMapping(value = "/app/reviewed.do")
	public String appreviewed(){
		return "app/review/reviewed";
	}
	
	@RequestMapping(value = "/app/unreviewed.do")
	public String appunreviewed(){
		return "app/review/unreviewed";
	}
	
	@RequestMapping(value = "/app/projectitem.do")
	public String appprojectitem(){
		Subject currentUser = SecurityUtils.getSubject();
		int roleid = ((UserInfo)currentUser.getSession().getAttribute("userInfo")).getRoleid();
		switch(roleid){
			case 1:
				return "app/functions/level0";
			case 2:
				return "app/functions/level1";
			case 3:
				return "app/functions/level2";
			case 4:
				return "app/functions/level3";
			default:
				return "404";
		}
	}
	
	@RequestMapping(value = "/app/plan.do")
	public String appplan(){
		return "app/functions/plan";
	}
	
	@RequestMapping(value = "/app/dailyplan.do")
	public ModelAndView appdailyplan(@RequestParam(value = "mainplanid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		PlanMain main = planMainService.selectByPrimaryKey(id);
		mav.addObject("planmain",main);
		mav.setViewName("app/functions/plandaily");
		return mav;
	}
	
	@RequestMapping(value = "/app/tochild.do")
	public ModelAndView tochild(@RequestParam(value = "projectitemid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ProjectItem main = projectItemService.selectByPrimaryKey(id);
		mav.addObject("projectitem",main);
		Subject currentUser = SecurityUtils.getSubject();
		int roleid = ((UserInfo)currentUser.getSession().getAttribute("userInfo")).getRoleid();
		if(roleid == 1){
			mav.setViewName("app/functions/projectitemchild0");
		}else if(roleid == 2){
			mav.setViewName("app/functions/projectitemchild1");
		}else if(roleid == 3){
			mav.setViewName("app/functions/projectitemchild2");
		}else{
			mav.setViewName("app/functions/projectitemchild3");
		}
		return mav;
	}
	
	@RequestMapping(value = "/app/budget.do")
	public String appbudget(){
		return "app/functions/budget";
	}
	
	@RequestMapping(value = "/app/camera.do")
	public String appcamera(){
		return "app/functions/camera";
	}
	
	@RequestMapping(value = "/app/imouplayer.do")
	public ModelAndView appimouplayer(@RequestParam(value = "cameraid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		Camera camera = cameraService.selectByPrimaryKey(id);
		List<CameraTime> list = cameraTimeService.search();
		mav.addObject("camera",camera);
		mav.addObject("cameraTime",list.get(0));
		mav.setViewName("app/functions/ImouPlayer");
		return mav;
	}
	
	@RequestMapping(value = "/app/warningmoney.do")
	public String appwarningmoney(){
		return "app/functions/warningmoney";
	}
	
	@RequestMapping(value = "/app/warningtime.do")
	public String appwarningtime(){
		return "app/functions/warningtime";
	}
	
	@RequestMapping(value = "/app/warningsafe.do")
	public String appwarningsafe(){
		return "app/functions/warningsafe";
	}
	
	@RequestMapping(value = "/app/warningequipment.do")
	public String appwarningequipment(){
		return "app/functions/warningequipment";
	}
	
	@RequestMapping(value = "/app/mailsend.do")
	public String appmailsend(){
		return "app/functions/mailsend";
	}
	
	@RequestMapping(value = "/app/mailboss.do")
	public String appmailboss(){
		return "app/functions/mailboss";
	}
	
	@RequestMapping(value = "/app/mailreceive.do")
	public String appmailreceive(){
		return "app/functions/mailreceive";
	}
	
	@RequestMapping(value = "/app/mailbox.do")
	public String apmailbox(){
		return "app/functions/mailbox";
	}
	
	@RequestMapping(value = "/app/equipment.do")
	public String appequipment(){
		return "app/functions/equipment";
	}
	
	@RequestMapping(value = "/app/equipmentmark.do")
	public String appequipmentmark(){
		return "app/functions/equipmentmark";
	}
	
	@RequestMapping(value = "/app/equipmentpressure.do")
	public String equipmentpressure(){
		return "app/functions/equipmentpressure";
	}
	
	@RequestMapping(value = "/app/goods.do")
	public String appgoods(){
		return "app/functions/goods";
	}
	
	@RequestMapping(value = "/app/forum.do")
	public String appforum(){
		return "app/functions/forum";
	}
	
	@RequestMapping(value = "/app/setper.do")
	public String appsetper(){
		return "app/functions/setper";
	}
	
	@RequestMapping(value = "app/toreply.do")
	public ModelAndView toreplyapp(@RequestParam(value = "postid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		ForumPost forumPost = forumPostService.selectByPrimaryKey(id);
		mav.addObject("forumPost",forumPost);
		mav.setViewName("app/functions/forumreply");
		return mav;
	}
	
	@RequestMapping(value = "app/toperson.do")
	public ModelAndView topersonapp(@RequestParam(value = "userid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		UserInfo userInfo = userInfoService.selectByPrimaryKey(id);
		mav.addObject("userInfo",userInfo);
		mav.setViewName("app/functions/forumperson");
		return mav;
	}
	
	@RequestMapping(value = "/app/goodscurrent.do")
	public ModelAndView appgoodscurrent(@RequestParam(value = "goodsid",required = true) int id){
		ModelAndView mav = new ModelAndView();
		Goods main = goodsService.selectByPrimaryKey(id);
		mav.addObject("goods",main);
		mav.setViewName("app/functions/goodscurrent");
		return mav;
	}
	
	@RequestMapping(value = "/app/detail/budgetexecute.do")
	public ModelAndView appdetailbudgetexecute(@RequestParam("id") int id,@RequestParam("projectitemid") int pid){
		ModelAndView mav = new ModelAndView();
		BudgetExecute budgetExecute = budgetExecuteService.selectByPrimaryKey(id);
		mav.addObject("budgetExecute",budgetExecute);
		mav.addObject("projectitemid",pid);
		mav.setViewName("app/detail/budgetexecute");
		return mav;
	}
	
	@RequestMapping(value = "/app/detail/capitalapply.do")
	public ModelAndView appdetailcapitalapply(@RequestParam("id") int id,@RequestParam("projectitemid") int pid){
		ModelAndView mav = new ModelAndView();
		CapitalApply capitalApply = capitalApplyService.selectByPrimaryKey(id);
		mav.addObject("capitalApply",capitalApply);
		mav.addObject("projectitemid",pid);
		mav.setViewName("app/detail/capitalapply");
		return mav;
	}
	
	@RequestMapping(value = "/app/detail/urgentapply.do")
	public ModelAndView appdetailurgentapply(@RequestParam("id") int id,@RequestParam("projectitemid") int pid){
		ModelAndView mav = new ModelAndView();
		UrgentApply urgentApply = urgentApplyService.selectByPrimaryKey(id);
		mav.addObject("urgentApply",urgentApply);
		mav.addObject("projectitemid",pid);
		mav.setViewName("app/detail/urgentapply");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewed/planmain.do")
	public ModelAndView appunreviewedplanmain(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("app/unreviewed/planmain");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewed/plandaily.do")
	public ModelAndView appunreviewedplandaily(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("app/unreviewed/plandaily");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewed/budgetmain.do")
	public ModelAndView appunreviewedbudgetmain(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("app/unreviewed/budgetmain");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewed/budgetexecute.do")
	public ModelAndView appunreviewedbudgetexecute(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("app/unreviewed/budgetexecute");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewed/urgentapply.do")
	public ModelAndView appunreviewedurgentapply(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("app/unreviewed/urgentapply");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewed/capitalapply.do")
	public ModelAndView appunreviewedcapitalapply(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("app/unreviewed/capitalapply");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewed/goods.do")
	public ModelAndView appunreviewedgoods(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("app/unreviewed/goods");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewed/goodscurrent.do")
	public ModelAndView appunreviewedgoodscurrent(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("app/unreviewed/goodscurrent");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewed/quantities.do")
	public ModelAndView appunreviewedquantities(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("projectitemid",id);
		mav.setViewName("app/unreviewed/quantities");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewedadd/planmain.do")
	public ModelAndView appunreviewedaddplanmain(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		PlanMain planMain = planMainService.selectByPrimaryKey(id);
		mav.addObject("planMain",planMain);
		mav.setViewName("app/unreviewed/planmainadd");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewedadd/plandaily.do")
	public ModelAndView appunreviewedaddplandaily(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		PlanDaily planDaily = planDailyService.selectByPrimaryKey(id);
		mav.addObject("planDaily",planDaily);
		mav.setViewName("app/unreviewed/plandailyadd");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewedadd/budgetmain.do")
	public ModelAndView appunreviewedaddbudgetmain(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		BudgetSubItem budgetSubItem = budgetSubItemService.selectByPrimaryKey(id);
		mav.addObject("budgetSubItem",budgetSubItem);
		mav.setViewName("app/unreviewed/budgetmainadd");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewedadd/urgentapply.do")
	public ModelAndView appunreviewedaddurgentapply(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		UrgentApply urgentApply = urgentApplyService.selectByPrimaryKey(id);
		mav.addObject("urgentApply",urgentApply);
		mav.setViewName("app/unreviewed/urgentapplyadd");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewedadd/capitalapply.do")
	public ModelAndView appunreviewedaddcapitalapply(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		CapitalApply capitalApply = capitalApplyService.selectByPrimaryKey(id);
		mav.addObject("capitalApply",capitalApply);
		mav.setViewName("app/unreviewed/capitalapplyadd");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewedadd/quantities.do")
	public ModelAndView appunreviewedaddquantities(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		Quantities quantities = quantitiesService.selectByPrimaryKey(id);
		mav.addObject("quantities",quantities);
		mav.setViewName("app/unreviewed/quantitiesadd");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewedadd/goods.do")
	public ModelAndView appunreviewedaddgoods(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		Goods goods = goodsService.selectByPrimaryKey(id);
		mav.addObject("goods",goods);
		mav.setViewName("app/unreviewed/goodsadd");
		return mav;
	}
	
	@RequestMapping(value = "/appunreviewedadd/goodscurrent.do")
	public ModelAndView appunreviewedaddgoodscurrent(@RequestParam("id") int id){
		ModelAndView mav = new ModelAndView();
		GoodsCurrent goodsCurrent = goodsCurrentService.selectByPrimaryKey(id);
		mav.addObject("goodsCurrent",goodsCurrent);
		mav.setViewName("app/unreviewed/goodscurrentadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/projectitemadd.do")
	public ModelAndView appprojectitemadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			ProjectItem projectItem = projectItemService.selectByPrimaryKey(id);
			mav.addObject("projectItem",projectItem);
		}
		mav.setViewName("app/functions/leveladd");
		return mav;
	}
	
	@RequestMapping(value = "/app/projectitemadd2.do")
	public ModelAndView appprojectitemadd2(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		ProjectItem projectItem = projectItemService.selectByPrimaryKey(id);
		mav.addObject("projectItem",projectItem);
		mav.setViewName("app/functions/leveladd2");
		return mav;
	}
	
	@RequestMapping(value = "/app/projectitemchildadd.do")
	public ModelAndView appprojectitemchildadd(@RequestParam(value = "id",required = false) Integer id,
			@RequestParam(value = "projectitemid",required = false) Integer projectitemid){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			ProjectItemChild projectItemChild = projectItemChildService.selectByPrimaryKey(id);
			mav.addObject("projectItemChild",projectItemChild);
		}else{
			ProjectItemChild projectItemChild = new ProjectItemChild();
			projectItemChild.setProjectitemid(projectitemid);
			mav.addObject("projectItemChild",projectItemChild);
		}
		mav.setViewName("app/functions/projectitemchildadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/projectitemchildadd2.do")
	public ModelAndView appprojectitemchildadd2(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		ProjectItemChild projectItemChild = projectItemChildService.selectByPrimaryKey(id);
		mav.addObject("projectItemChild",projectItemChild);
		mav.setViewName("app/functions/projectitemchildadd2");
		return mav;
	}
	
	@RequestMapping(value = "/app/planadd.do")
	public ModelAndView appplanadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			PlanMain planMain = planMainService.selectByPrimaryKey(id);
			mav.addObject("planMain",planMain);
		}
		mav.setViewName("app/functions/planadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/plandailyadd.do")
	public ModelAndView appplandailyadd(@RequestParam(value = "id",required = false) Integer id,
			@RequestParam(value = "planid",required = false) Integer planid){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			PlanDaily planDaily = planDailyService.selectByPrimaryKey(id);
			mav.addObject("planDaily",planDaily);
		}else{
			PlanDaily planDaily = new PlanDaily();
			planDaily.setMainid(planid);
			mav.addObject("planDaily",planDaily);
		}
		mav.setViewName("app/functions/plandailyadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/budgetadd.do")
	public ModelAndView appbudgetadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			BudgetSubItem budgetSubItem = budgetSubItemService.selectByPrimaryKey(id);
			mav.addObject("budgetSubItem",budgetSubItem);
		}
		mav.setViewName("app/functions/budgetadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/attendanceadd.do")
	public ModelAndView appattendanceadd(@RequestParam(value = "projectitemid",required = false) Integer projectitemid,
			@RequestParam(value = "projectitemchildid",required = false) Integer projectitemchildid,
			@RequestParam(value = "date",required = false) String date){
		ModelAndView mav = new ModelAndView();
		ProjectItem projectItem = projectItemService.selectByPrimaryKey(projectitemid);
		mav.addObject("projectItem",projectItem);
		mav.addObject("date",date);
		if(projectitemchildid != null){
			ProjectItemChild projectItemChild = projectItemChildService.selectByPrimaryKey(projectitemchildid);
			mav.addObject("projectItemChild",projectItemChild);
		}
		mav.setViewName("app/functions/attendanceadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/safetyinspectionadd.do")
	public ModelAndView appsafetyinspectionadd(
			@RequestParam(value = "projectitemid",required = false) Integer projectitemid,
			@RequestParam(value = "projectitemchildid",required = false) Integer projectitemchildid,
			@RequestParam(value = "date",required = false) String date){
		ModelAndView mav = new ModelAndView();
		ProjectItem projectItem = projectItemService.selectByPrimaryKey(projectitemid);
		mav.addObject("projectItem",projectItem);
		mav.addObject("date",date);
		if(projectitemchildid != null){
			ProjectItemChild projectItemChild = projectItemChildService.selectByPrimaryKey(projectitemchildid);
			mav.addObject("projectItemChild",projectItemChild);
		}
		mav.setViewName("app/functions/safetyinspectionadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/reportadd.do")
	public ModelAndView appreportadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		PlanDaily planDaily = planDailyService.selectByPrimaryKey(id);
		mav.addObject("planDaily",planDaily);
		mav.setViewName("app/functions/reportadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/capitalapplyadd.do")
	public ModelAndView appcapitalapplyadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			CapitalApply capitalApply = capitalApplyService.selectByPrimaryKey(id);
			mav.addObject("capitalApply",capitalApply);
		}
		mav.setViewName("app/functions/capitalapplyadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/urgentapplyadd.do")
	public ModelAndView appurgentapplyadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			UrgentApply urgentApply = urgentApplyService.selectByPrimaryKey(id);
			mav.addObject("urgentApply",urgentApply);
		}
		mav.setViewName("app/functions/urgentapplyadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/budgetexecuteadd.do")
	public ModelAndView appbudgetexecuteadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			BudgetExecute budgetExecute = budgetExecuteService.selectByPrimaryKey(id);
			mav.addObject("budgetExecute",budgetExecute);
		}
		mav.setViewName("app/functions/budgetexecuteadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/warningsafeadd.do")
	public ModelAndView appwarningsafeadd(
			@RequestParam(value = "inspectiondate",required = false) String inspectiondate){
		ModelAndView mav = new ModelAndView();
		mav.addObject("inspectiondate",inspectiondate);
		mav.setViewName("app/functions/warningsafeadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/warningequipmentadd.do")
	public ModelAndView appwarningequipmentadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		EquipmentMark equipmentMark = equipmentMarkService.selectByPrimaryKey(id);
		mav.addObject("equipmentMark",equipmentMark);
		mav.setViewName("app/functions/warningequipmentadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/equipmentadd.do")
	public ModelAndView equipmentadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			Equipment equipment = equipmentService.selectByPrimaryKey(id);
			mav.addObject("equipment",equipment);
		}
		mav.setViewName("app/functions/equipmentadd");
		return mav;
	}
	
	
	@RequestMapping(value = "/app/equipmentmarkadd.do")
	public ModelAndView equipmentmarkadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			EquipmentMark equipmentMark = equipmentMarkService.selectByPrimaryKey(id);
			mav.addObject("equipmentMark",equipmentMark);
		}
		mav.setViewName("app/functions/equipmentmarkadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/goodsadd.do")
	public ModelAndView goodsadd(@RequestParam(value = "id",required = false) Integer id){
		ModelAndView mav = new ModelAndView();
		if(id != null){
			Goods goods = goodsService.selectByPrimaryKey(id);
			mav.addObject("goods",goods);
		}
		mav.setViewName("app/functions/goodsadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/goodscurrentadd.do")
	public ModelAndView goodscurrentadd(@RequestParam(value = "goodsid",required = false) Integer goodsid){
		ModelAndView mav = new ModelAndView();
		Goods goods = goodsService.selectByPrimaryKey(goodsid);
		mav.addObject("goods",goods);
		mav.setViewName("app/functions/goodscurrentadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/forumadd.do")
	public ModelAndView forumadd(){
		ModelAndView mav = new ModelAndView();
		mav.setViewName("app/functions/forumadd");
		return mav;
	}
	
	@RequestMapping(value = "/app/sessiontimeout")
	@ResponseBody
	public Boolean sessiontimeout(HttpServletRequest request){
		HttpSession session = request.getSession();
		Object obj = session.getAttribute("userInfo");
		if(obj==null){
			return false;
		}else{
			return true;
		}
	}
	
	@RequestMapping(value = "/app/pressurehistory.do")
	public ModelAndView pressurehistory(@RequestParam(value = "id",required = true) Integer id){
		ModelAndView mav = new ModelAndView();
		mav.addObject("id", id);
		mav.setViewName("app/functions/equipmentpressurehistory");
		return mav;
	}
}
